package modelLayer;

/**
 * Class Person is a super class representing shared characteristics of person types.
 *
 * @author  Danny M.P., Jakob K., Anna K., Thomas V.  
 * @version 1.0
 */

public class Person {
	
	private String name,
				   address,
				   city,
				   country,
				   phoneNo,
				   email;
	private	int	   zipCode;
	
	public Person(String name, String address, String city, String country, 
				  String phoneNo, String email, int zipCode) {
		
		if (!(this.setName(name))) {
			throw new IllegalArgumentException("Det indtastede navn er ikke gyldigt. Pr�v igen.");
		}
		if (!(this.setAddress(address))) {
			throw new IllegalArgumentException("Den indtastede addresse er ikke gyldig. Pr�v igen.");
		}
		if (!(this.setCity(city))) {
			throw new IllegalArgumentException("Den indtastede by er ikke gyldig. Pr�v igen.");
		}
		if (!(this.setCountry(country))) {
			throw new IllegalArgumentException("Det indtastede land er ikke gyldigt. Pr�v igen.");
		}
		if (!(this.setPhoneNo(phoneNo))) {
			throw new IllegalArgumentException("Det indtastede telefonnummer er ikke gyldigt. Pr�v igen.");
		}
		if (!(this.setEmail(email))) {
			throw new IllegalArgumentException("Den indtastede e-mail er ikke gyldig. Pr�v igen.");
		}
		if (!(this.setZipCode(zipCode))) {
			throw new IllegalArgumentException("Det indtastede postnummer er ikke gyldigt. Pr�v igen.");
		}
		
	}
	
	public Person() {
		
		
		
	}
	
	/**
     * Sets the zipCode of the person.
     *
     * @param int adds zipCode.
     */
	public boolean setZipCode(int zipCode) {
		
		if (zipCode == 0 || 10000 <= zipCode) {
			return false;
		}
		else {
			this.zipCode = zipCode;
			return true;
		}
		
	}
	
	/**
     * Sets the email address of the person.
     *
     * @param String adds email.
     */
	public boolean setEmail(String email) {
		
		if (email.equals(null) || email.isEmpty() || email.length() <= 1 ) {
			return false;
		}
		else {
			this.email = email;
			return true;
		}
		
	}
	
	/**
     * Sets the phoneNr of the person.
     *
     * @param String adds phoneNr.
     */
	public boolean setPhoneNo(String phoneNo) {
		
		if (phoneNo == null || phoneNo.isEmpty() || phoneNo.length() <= 1 ) {
			return false;
		}
		else {
			this.phoneNo = phoneNo;
			return true;
		}
		
	}
	
	/**
     * Sets the country address of the person.
     *
     * @param String adds country.
     */
	public boolean setCountry(String country) {
		
		if (country == null || country.isEmpty() || country.length() <= 1) {
			return false;
		}
		else {
			this.country = country;
			return true;
		}
		
	}
	
	/**
     * Sets the city address of the person.
     *
     * @param String city adds city.
     */
	public boolean setCity(String city) {
		
		if (city == null || city.isEmpty() || city.length() <= 1) {
			return false;
		}
		else {
			this.city = city;
			return true;
		}
		
	}	
	
	/**
     * Sets the name of the person.
     *
     * @param String adds name.
     */
	public boolean setName(String name) {
		
		if (name == null || name.isEmpty() || name.length() <= 1) {
			return false;
		}
		else {
			this.name = name;
			return true;
		}
		
	}
	
	/**
     * Sets the address of the person.
     *
     * @param String adds address.
     */
	public boolean setAddress(String address) {
		
		if (address == null || address.isEmpty() || address.length() <= 1) {
			return false;
		}
		else {
			this.address = address;
			return true;
		}
		
	}

	public String getName() {
		
		return this.name;
		
	}

	public String getAddress() {
		
		return this.address;
		
	}

	public String getCity() {
		
		return this.city;
		
	}

	public String getCountry() {
		
		return this.country;
		
	}

	public String getPhoneNo() {
		
		return this.phoneNo;
		
	}

	public String getEmail() {
		
		return this.email;
		
	}

	public int getZipCode() {
		
		return this.zipCode;
		
	}	

}
